package org.cms;

import org.cms.annotation.GoogleCalendar;
import org.cms.dao.IDao;
import org.cms.entities.Event;

import javax.annotation.Resource;
import javax.ejb.*;
import javax.inject.Inject;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;

@Singleton
public class CalendarServicePoller {

//    @Resource
//    private TimerService timerService;

    private Date lastAutomaticTimeout;

    @Inject
    @GoogleCalendar
    ICalendarService<Event> calendarService;

    private Logger log = Logger.getLogger(CalendarServicePoller.class.getName());

    @Schedule(minute = "*/2", hour = "*")
    public void getEventsFromCalendar() {
        log.info("Trying to fetch google calendar events");
        calendarService.getUserCalendar();
    }


}
